<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('资产领用列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list" style="display: none;">
                        <li>
                            <label>类型：</label>
                            <select name="receiveType" th:with="type=${@dict.getType('receive_type')}">
                                <option value="2">借用</option>
                                <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
                            </select>
                        </li>
                        <ul>
                            <li class="select-time">
                                <label>预计归还：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPredictTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPredictTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('assets:receive:edit')}]];
        var removeFlag = [[${@permission.hasPermi('assets:receive:remove')}]];
        var receiveTypeDatas = [[${@dict.getType('receive_type')}]];
        var prefix = ctx + "assets/borrow";

        $(document).ready(function(){
            var ptime = "2000-01-01";
            $("*[name='params[beginPredictTime]']").val(ptime);

            var currtime = new Date().Format("yyyy-MM-dd");
            $("*[name='params[endPredictTime]']").val(currtime);
        });

        $(function() {
            var options = {
                url: prefix + "/predictedlist",
                createUrl: prefix + "/add",
                detailUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "createTime",                         // 排序列名称
                sortOrder: "desc",
                modalName: "资产借用",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'receiveId',
                    title: '',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '借用人'
                },
                {
                    field: 'assetsId',
                    title: '资产编号'
                },
                {
                    field: 'assetsName',
                    title: '资产名称'
                },
                {
                    field: 'assetsSn',
                    title: 'SN号'
                },
                {
                    field: 'receiveTime',
                    title: '借用日期'
                },
                {
                    field: 'predictTime',
                    title: '预计归还时间'
                }
                ]
            };
            $.table.init(options);
        });


        Date.prototype.Format = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1, //月份
                "d+": this.getDate(), //日
                "H+": this.getHours(), //小时
                "m+": this.getMinutes(), //分
                "s+": this.getSeconds(), //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds() //毫秒
            };
            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
        }
    </script>
</body>
</html>